package edu.its.dreamteam.web.base;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import org.apache.tapestry.annotations.ApplicationState;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.annotations.Inject;

import edu.its.dreamteam.web.state.Visit;

public class SimpleBasePage {

	@ApplicationState
	private Visit visit;
	private boolean visitExists;
	
	
	// Formatters
	// If you want to make these static or move them into Visit, first read
	// http://thread.gmane.org/gmane.comp.java.tapestry.user/20925
	private DateFormat dateViewFormat = new SimpleDateFormat("dd/MM/yyyy");
	private DateFormat dateListFormat = new SimpleDateFormat("dd/MM/yyyy");

	@Inject
	private Messages messages;

	protected Messages getMessages() {
		return messages;
	}

	public DateFormat getDateViewFormat() {
		return dateViewFormat;
	}

	public DateFormat getDateListFormat() {
		return dateListFormat;
	}
	
	public String getDateFieldFormat() {
		return "%d/%m/%Y";
	}

	public Visit getVisit() {
		return visit;
	}

	public boolean isVisitExists() {
		return visitExists;
	}

}
